package quant.smart.crawl.domain;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public abstract class ServiceBase {
	
	
	protected Object getAndWaitResult(Future<Object> future){
		Object res =null;
		try {
			res = future.get();
			return res;
		} catch (InterruptedException e) {
			e.printStackTrace();
			Thread.currentThread().interrupt();
			future.cancel(true);			
		} catch (ExecutionException e) {
			e.printStackTrace();
			future.cancel(true);			
		}
		throw new RuntimeException("命令执行失败!");
	}
}
